import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/layout'
Vue.use(Router)
// 通用页面
export const constRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login'),
    hidden: true //导航菜单忽略该项
  },
  {
    path: '/',
    component: Layout, //应用布局
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: () => import('@/views/Home.vue'),
        name: 'Home',
        meta: {
          title: 'Home', //导航菜单项标题
          icon: 'qq'
        }
      },
      {
        path: 'icon',
        component: () => import('@/views/icon'),
        name: 'Icon',
        meta: {
          title: 'Icon', //导航菜单项标题
          icon: 'wx'
        }
      }
    ]
  }
]
// 权限页面
export const asyncRoutes = [
  {
    path: '/about',
    component: Layout,
    redirect: '/about/index',
    children: [
      {
        path: 'index',
        component: () => import('@/views/about'),
        name: 'About',
        meta: {
          title: "About",
          icon: 'qq',
          roles: ['admin', 'editor']
        }
      }
    ]
  }
]
export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: constRoutes
})
